package ru.nsu.ccfit.shumkina.algorithm.logworks;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Вера
 * Time: 20:04
 * To change this template use File | Settings | File Templates.
 */
public class Session {
    // todo: getters/setters and so on
    public String userId;
    public ArrayList<String> userFullPath;

    Session(String userId, ArrayList<String> userFullPath){
        this.userId = userId;
        this.userFullPath = userFullPath;
        }

    public void clearPath() {
        if (userFullPath.size() <= 1)
            return;
        String firstPage = userFullPath.get(0);
        while (userFullPath.lastIndexOf(firstPage) != 0)
                userFullPath.remove(0);
        for (int i = 0; i < userFullPath.size(); i++)
        {
            String currPage = userFullPath.get(i);
            while (userFullPath.lastIndexOf(currPage) != i)
                userFullPath.remove(i);
        }
    }
}
